<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<%
	String path = request.getContextPath();
	// 获得本项目的地址(例如: http://localhost:8080/MyApp/)赋值给basePath变量 
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	// 将 "项目路径basePath" 放入pageContext中，待以后用EL表达式读出。 
	pageContext.setAttribute("basePath", basePath);
	//out.write(basePath);
%>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>添加课程</title>

<meta name="description"
	content="Source code generated using layoutit.com">
<meta name="author" content="LayoutIt!">

<link href="<%=basePath%>bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<link href="<%=basePath%>bootstrap/css/style.css" rel="stylesheet">



<!--派生选择器设置提示信息的字体颜色-->
<style type="text/css">
div span {
	color: red;
}
</style>
<script src="<%=basePath%>bootstrap/js/jquery.min.js"></script>
<script src="<%=basePath%>bootstrap/js/bootstrap.min.js"></script>
<script src="<%=basePath%>bootstrap/js/scripts.js"></script>
<script type="text/javascript">
	//添加课程信息信息-表单验证
	//1.课程ID非空验证
	function checkId() {
		//获取输入的内容
		var inputClassId = document.getElementById("inputClassId").value;
		//错误提示框信息内容
		var spClassId = document.getElementById("spClassId");
		if (inputClassId == null || inputClassId == "") {
			//提示信息
			spClassId.innerHTML = "请输入课程ID！";
			//改变标志量
			return false;
		} else {
			//清空提示信息
			spClassId.innerHTML = "";
			return true;
		}
	}

	//2.课程名非空验证
	function checkName() {
		//获取输入的内容
		var inputClassName = document.getElementById("inputClassName").value;
		//错误提示框信息内容
		var spClassName = document.getElementById("spClassName");
		if (inputClassName == null || inputClassName == "") {
			//提示信息
			spClassName.innerHTML = "请输入课程名！";
			//改变标志量
			return false;
		} else {
			//清空提示信息
			spClassName.innerHTML = "";
			return true;
		}
	}
	//进行最后的提交验证
	function checkAll() {
		var ischid = checkId();
		var ischName = checkName();

		if (ischid && ischName) {
			return true;
		} else {
			return false;
		}
	}
</script>
</head>
<body>

	<div id="container" align="center">
		<div style="width: 500px;" align="left">
			<h4 align="center">添加/修改课程信息</h4>
			<form class="form-horizontal" role="form"
				action="<%=basePath%>InsertTeaClass" method="post">

				<input type="hidden" id="inputclassNum" name="inputclassNum"
					value="${requestScope.scClassB.classber}">

				<div class="form-group">
					<label for="inputClassId" class="col-sm-2 control-label">课程ID&nbsp;</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" id="inputClassId"
							name="inputClassId" placeholder=课程ID
							value="${requestScope.scClassB.classid}" onblur="checkId();">
						<div>
							<span id="spClassId"></span>
						</div>
					</div>
				</div>

				<div class="form-group">
					<label for="inputClassName" class="col-sm-2 control-label">课程名&nbsp;</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" id="inputClassName"
							name="inputClassName" placeholder=课程名
							value="${requestScope.scClassB.classname}" onblur="checkName();">
						<div>
							<span id="spClassName"></span>
						</div>
					</div>
				</div>

				<div class="form-group">
					<div class="col-sm-offset-2 col-sm-10">
						<button type="submit" class="btn btn-default"
							onclick="return checkAll();">提交</button>
					</div>
				</div>
			</form>
		</div>
	</div>



</body>
</html>